1. Field of the Invention
The present invention relates to a key-pressing circuit, and more particularly, to a key-pressing circuit that can determine the corresponding position of an actuated key according to its discharging time period.
2. Description of the Prior Art
Please refer to FIG. 1. FIG. 1 is a schematic diagram of a prior art key-pressing circuit 10. The key-pressing circuit 10 comprises m drive lines A,B,C . . . ,M used to input a scan pulse, n output lines a,b,c, . . . ,n used to output the scan pulse, and m*n keys Aa,Ab, . . . ,Mn arranged in a matrix. A scan pulse is input into the m drive lines one by one in rotation. If the scan pulse is input into the drive line B, and the key Bb is actuated, a current will flow from the drive line B through the key Bb and then to the output line b (as depicted by the solid line 12). Hence, the output line b will deliver the scan pulse signal and from this it can be deduced that key Bb is actuated.
However, if the scan pulse is input into the drive line B, and the keys Bb, Cb and Cd are all simultaneously actuated, then in addition to an output pulse on line b, there will also be an output pulse on line d (as indicated by the dashed line 14). An output pulse on line d with an input pulse from line B will force the conclusion that the key Bd has been actuated, which is incorrect. So, in this situation, a false code is generated, a so-called xe2x80x9cghost keyxe2x80x9d or xe2x80x9cphantom keyxe2x80x9d. In addition to this shortcoming, the m drive lines and n output lines of the key-pressing circuit 10 must occupy m+n ports of a processor. The usage of so many ports is not economical.
Another prior art method, U.S. Pat. No. 5,619,169, addresses a key-pressing circuit using a single transmission wire. In this circuit a plurality of resistors with the same resistance are arranged in series and connect to a capacitor. When a key is actuated the capacitor will discharge via the series resistors coupled to ground. By monitoring the time of the discharge, the key that was actuated can be determined. This prior art method, however, only permits one discharge process for a single key actuation, and so errors can easily occur. Consequently, it can only detect one key press at a time, and so cannot be applied to situations where two or more keys are actuated simultaneously.
It is therefore a primary objective of the present invention to provide a key-pressing circuit which can determine the corresponding position of an actuated key according to its discharging time period with a property that, within the time period that the key is actuated once, a discharge process is performed many times to solve the above mentioned problem.
In a preferred embodiment, the present invention provides a key-pressing circuit used for encoding and decoding key-press position information of a keyed input device, the key-pressing circuit has a control unit. The control unit comprises a controlling port and a detecting port. The controlling port can be in either a grounded state or a floating state. The key-pressing circuit also has a first charge storage circuit, which has a charging port that connects to the detecting port of the control unit, and a key matrix circuit. The key matrix circuit has a plurality of resistors and an associated plurality of switches. Each of the resistors and each of the switches has a first end and a second end. The first end of each resistor connects to the second end of its neighboring resistor so that the plurality of resistors forms a series resistor circuit that has a first end and a second end. The first end of each switch separately connects to the second end of its associated resistor. The second end of each switch connects to the controlling port of the control unit. The first end of the series resistor circuit connects to the charging port of the first charge storage circuit. When a switch is actuated and the controlling port is in the grounded state, the first charge storage circuit will discharge. However, when a switch is actuated and the controlling port is in the floating state, the first charge storage circuit will recharge. The detecting port detects if the charging port of the first charge storage circuit reaches a predetermined voltage. The control unit measures the time period from when the controlling port reached the grounded state till the detecting port detects the predetermined voltage, and the control unit determines the corresponding position of the actuated switch according to this time period.
It is an advantage of the present invention that the key-pressing circuit does not have the said xe2x80x9cghost keyxe2x80x9d problem and needs fewer processor ports than the prior art key-pressing circuit. Furthermore, a discharge process is performed many times within the time period of a typical key actuation, so the determination of the corresponding position of an actuated key will be more accurate.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after having read the following detailed description of the preferred embodiment which is illustrated in the various figures and drawings.